/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package automate;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author S219
 */
class StopListener implements ActionListener {
    Diapositives diapo;
    public StopListener(Diapositives diapo) {
        this.diapo = diapo;
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        switch(diapo.getEtat()){
            case 2 :
            case 3 :
            case 4 :
            case 5 :
            case 6 :
            case 7 :
            case 8 :
            case 9 :
            case 10 :
            case 11 :
            case 12 :
            case 13 :
                try {
                    diapo.retourEtatInitial();
                    diapo.setEtat(0);
                    diapo.getTimer().stop();
                } catch (IOException ex) {
                    Logger.getLogger(StopListener.class.getName()).log(Level.SEVERE, null, ex);
                }
                break;
        }
    }
    
}
